package com.tuda.common.pay.common.enums;

/**
 * @author lixiaoguang
 * @version $Id: PayTypeEnum.java, v 0.1 2017年9月7日 下午8:12:30 lixiaoguang Exp $
 */
public enum PayTypeEnum {

    WAIT("未支付", 0),

    ALIPAY("支付宝", 1),//原生支付宝支付

    WECHAT("微信", 2),//

    MINI("微信小程序", 3),
    ;

    private String name;
    private Integer code;

    PayTypeEnum(String name, Integer code) {
        this.name = name;
        this.code = code;
    }

    /**
     * 根据code获取name
     *
     * @param code
     * @return
     */
    public static String getDescByCode(String code) {
        if (code == null) {
            return "未支付";
        }
        for (PayTypeEnum object : PayTypeEnum.values()) {
            if (code.equals(String.valueOf(object.getCode()))) {
                return object.getName();
            }
        }
        return null;
    }


    /**
     * Getter method for property <tt>name</tt>.
     *
     * @return property value of name
     */
    public String getName() {
        return name;
    }

    /**
     * Setter method for property <tt>name</tt>.
     *
     * @param name value to be assigned to property name
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * Getter method for property <tt>code</tt>.
     *
     * @return property value of code
     */
    public Integer getCode() {
        return code;
    }

    /**
     * Setter method for property <tt>code</tt>.
     *
     * @param code value to be assigned to property code
     */
    public void setCode(Integer code) {
        this.code = code;
    }

}
